package com.example.demo.services;

import com.example.demo.dao.UserMapper;
import com.example.demo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;
    public Object login (String username,String password){
        User user = userMapper.selectByName(username);
        System.out.println(user);
        String password1 = user.getPassword();

        if(user == null || !password1.equals(password)){
            System.out.println("登录失败"+user);
            return new User();
        }
        System.out.println("登录成功");
        return user;
    }
}
